package cn.iocoder.yudao.framework.operatelog.api.dal.mysql.permission;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.framework.operatelog.api.controller.vo.ApiPermissionExportReqVO;
import cn.iocoder.yudao.framework.operatelog.api.controller.vo.ApiPermissionPageReqVO;
import cn.iocoder.yudao.framework.operatelog.api.dal.dataobject.permission.ApiPermissionDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 *  Mapper
 *
 * @author 芋艿
 */
@Mapper
public interface ApiPermissionMapper extends BaseMapperX<ApiPermissionDO> {

    default PageResult<ApiPermissionDO> selectPage(ApiPermissionPageReqVO reqVO) {
        return selectPage(reqVO, new QueryWrapperX<ApiPermissionDO>()
                .likeIfPresent("api_name", reqVO.getApiName())
                .orderByDesc("id")        );
    }

    default List<ApiPermissionDO> selectList(ApiPermissionExportReqVO reqVO) {
        return selectList(new QueryWrapperX<ApiPermissionDO>()
                .likeIfPresent("api_name", reqVO.getApiName())
                .orderByDesc("id")        );
    }

}
